# == Schema Information
#
# Table name: permissions
#
#  id          :integer(4)      not null, primary key
#  name        :string(40)      not null
#  description :string(255)     not null
#  created_at  :datetime
#  updated_at  :datetime
#

class Permission < ActiveRecord::Base
   has_many :permissions_roles , :class_name => "Permissions_Role" ,:foreign_key => :permission_id,:dependent => :destroy
   has_many :roles ,:through=>:permissions_roles ,:source => :role,:class_name => "Role"

  validates_uniqueness_of :name
   validates_presence_of :name
   validates_length_of    :name,        :maximum => 50  , :allow_nil => true
end
